import mongoose, { Schema, Document } from 'mongoose';

// 定义群组成员接口
interface IGroupMember extends Document {
    memberId: string;
}

// 定义群组成员模式
const GroupMemberSchema = new Schema<IGroupMember>({
    memberId: { type: String, required: true }
});

// 创建群组成员模型
function getGroupMemberByGroupId(GroupId: string) {
    try {
        const modelName = `GroupMember_${GroupId}`;
        return mongoose.model<IGroupMember>(modelName, GroupMemberSchema);
    } catch (error) {
        return null; // 发生错误时返回 null`
    }
}
export default getGroupMemberByGroupId;

